VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "TestResultPrimitive"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Option Explicit

Private mResult As New ResultPrimitive

Private mErrorNumber As Integer
Private mErrorDesc As String

Public Sub testNotifierIsNothing()
givenNotifierIs Nothing
whenAssertCalled
thenErrorIs 91
End Sub
Public Sub testNotifierIsMe()
givenNotifierIs Me
whenAssertCalled
thenErrorIs 438
End Sub
Public Sub testNotifierIsMock()
givenNotifierIs New MockNotifier
whenAssertCalled
thenErrorIs 0
End Sub
Public Sub testAssertThrows()
givenNotifierIs New MockNotifier
whenAssertCalled False
thenErrorIs 1001
thenDescriptionIs "VBUnit assert termination"
End Sub
Public Sub testExpectDoesNowThrow()
givenNotifierIs New MockNotifier
whenExpectCalled False
thenErrorIs 0
End Sub

''
''

Private Sub givenNotifierIs(notifier As Object)
mResult.setNotification notifier
End Sub

Private Sub whenAssertCalled(Optional result As Boolean = True)
On Error GoTo whenAssertCalled_Error

mResult.primitiveAssert result, "", "", "", ""

On Error GoTo 0
Exit Sub

whenAssertCalled_Error:
mErrorNumber = Err.number
mErrorDesc = Err.Description
End Sub
Private Sub whenExpectCalled(Optional result As Boolean = True)
On Error GoTo whenExpectCalled_Error

mResult.primitiveExpect result, "", "", "", ""

On Error GoTo 0
Exit Sub

whenExpectCalled_Error:
mErrorNumber = Err.number
mErrorDesc = Err.Description
End Sub

Private Sub thenErrorIs(number As Integer)
assert.equals mErrorNumber, number, "Error is" + Str(number)
End Sub
Private Sub thenDescriptionIs(desc As String)
assert.equals mErrorDesc, desc, "Description is " + desc
End Sub

'OPTIONAL METHODS
Public Sub setup()
mErrorDesc = ""
mErrorNumber = 0
End Sub
'Public Sub teardown()
''
'End Sub
Public Function NumOfAsserts() As Long
NumOfAsserts = 6
End Function

